Optimal. Leaf size=39 \[ \left (a^2-b^2\right ) x-\frac {2 a b \log (\cos (c+d x))}{d}+\frac {b^2 \tan (c+d x)}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.01, antiderivative size = 39, normalized size of antiderivative = 1.00, number of steps
used = 2, number of rules used = 2, integrand size = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.167, Rules used = {3558, 3556}
\begin {gather*} x \left (a^2-b^2\right )-\frac {2 a b \log (\cos (c+d x))}{d}+\frac {b^2 \tan (c+d x)}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3558
Rubi steps
\begin {align*} \int (a+b \tan (c+d x))^2 \, dx &=\left (a^2-b^2\right ) x+\frac {b^2 \tan (c+d x)}{d}+(2 a b) \int \tan (c+d x) \, dx\\ &=\left (a^2-b^2\right ) x-\frac {2 a b \log (\cos (c+d x))}{d}+\frac {b^2 \tan (c+d x)}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.10, size = 69, normalized size = 1.77 \begin {gather*} \frac {-i \left ((a+i b)^2 \log (i-\tan (c+d x))-(a-i b)^2 \log (i+\tan (c+d x))\right )+2 b^2 \tan (c+d x)}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.02, size = 47, normalized size = 1.21
method | result | size |
norman | \(\left (a^{2}-b^{2}\right ) x +\frac {b^{2} \tan \left (d x +c \right )}{d}+\frac {a b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}\) | \(43\) |
derivativedivides | \(\frac {b^{2} \tan \left (d x +c \right )+a b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )+\left (a^{2}-b^{2}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(47\) |
default | \(\frac {b^{2} \tan \left (d x +c \right )+a b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )+\left (a^{2}-b^{2}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(47\) |
risch | \(2 i a b x +a^{2} x -b^{2} x +\frac {4 i a b c}{d}+\frac {2 i b^{2}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {2 a b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) | \(69\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.55, size = 41, normalized size = 1.05 \begin {gather*} a^{2} x - \frac {{\left (d x + c - \tan \left (d x + c\right )\right )} b^{2}}{d} + \frac {2 \, a b \log \left (\sec \left (d x + c\right )\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.05, size = 44, normalized size = 1.13 \begin {gather*} \frac {{\left (a^{2} - b^{2}\right )} d x - a b \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + b^{2} \tan \left (d x + c\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.07, size = 48, normalized size = 1.23 \begin {gather*} \begin {cases} a^{2} x + \frac {a b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} - b^{2} x + \frac {b^{2} \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (a + b \tan {\left (c \right )}\right )^{2} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 201 vs.
\(2 (39) = 78\).
time = 0.56, size = 201, normalized size = 5.15 \begin {gather*} \frac {a^{2} d x \tan \left (d x\right ) \tan \left (c\right ) - b^{2} d x \tan \left (d x\right ) \tan \left (c\right ) - a b \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right ) \tan \left (c\right ) - a^{2} d x + b^{2} d x + a b \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) - b^{2} \tan \left (d x\right ) - b^{2} \tan \left (c\right )}{d \tan \left (d x\right ) \tan \left (c\right ) - d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.09, size = 136, normalized size = 3.49 \begin {gather*} \frac {a^2\,\mathrm {atan}\left (\frac {a^2\,\mathrm {tan}\left (c+d\,x\right )}{a^2-b^2}-\frac {b^2\,\mathrm {tan}\left (c+d\,x\right )}{a^2-b^2}\right )}{d}-\frac {b^2\,\mathrm {atan}\left (\frac {a^2\,\mathrm {tan}\left (c+d\,x\right )}{a^2-b^2}-\frac {b^2\,\mathrm {tan}\left (c+d\,x\right )}{a^2-b^2}\right )}{d}+\frac {b^2\,\mathrm {tan}\left (c+d\,x\right )}{d}+\frac {a\,b\,\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________